#ifndef _tenacitas__log__text_file_h_
#define _tenacitas__log__text_file_h_

/** @file
    Definition of a text file logger */

/** @todo */

// ==> C++ Headers
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>

// ==> 3rds Headers
#include <boost/shared_ptr.hpp>

// ==> Our Headers
#include <tenacitas.exception/exception.h>
#include <tenacitas.boost_tools/utils.h>

#include "logger.h"
#include "file.h"
#include "level.h"
#include "change_file_handler.h"
#include "change_file_notifier.h"
#include "text_line.h"

// ==> Namespaces
using namespace std;

// ==> Macro Contants
#ifndef DIR_LOG
DIR_LOG "."
#endif

// ==> Macro Commands


/** namespace of the organization */
namespace tenacitas {
    /** namespace for the project */
    namespace log {

        // ==> Typedefs 

        // ==> Pre-Declarations

        // ==> Attributes 

        // ==> Functions
        
        // ==> Classes

        /** Text file logger

            This logger specializes @p tenacitas::log::logger with @p
            tenacitas::log::file, itself specialized with
            tenacitas::log::text_line, tenacitas::log::change_file_notifier,
            and tenacitas::log::change_file_handler.

            <b>A word to the programmer user</b>
            You, dear programmer, only need to call the @p config
            to configure the @p tenacitas::log::text_file factory.
            To use the @p tenacitas::log::text_file, please read the section <b>A
            word to the programmer user</b> in the tenacitas::log::logger class
            documentation in <tt>cpp/code/inc/tenacitas_log/logger.h</tt> file.
        */
        class text_file : public logger<file<text_line,
                                             change_file_notifier,
                                             change_file_handler> > {
        public:

            // ==> text_file - Public Constructors

            /** Destructor */
            ~text_file( ){}

            /** Configures the @p text_file factory

                @param  p_pgm_name is the name of the program name that will
                generate the log messages
                @param  p_pid is the process identifier of the process that is
                generating the log messages
                @param  p_level is the tenacitas::log::level to be used
                for all the @p text_log_file objects created
                @param  p_max_file_size is the maximum size that a log file can
                reach, before a new log file is created
                @param  p_dir_log is the directory where the log files will be
                created */
            static void config(const std::string & p_pgm_name,
                               std::int64_t p_pid,
                               tenacitas::log::level p_level =
                               tenacitas::log::level::info,
                               uint64_t p_max_file_size = 1024 * 1014 * 10,
                               const std::string & p_dir_log = DIR_LOG );

        };
    }
}

// =============================================================================
//                     I M P L E M E N T A T I O N
// =============================================================================

using namespace tenacitas::log;


#endif



